package com.jbm.core.common;

import com.google.protobuf.ByteString;

import java.lang.reflect.Method;
import java.nio.ByteBuffer;
import java.util.HashMap;

/**
 * Created by root on 17-3-23.
 */
public class Cast
{
	public final static HashMap<Class<?>,HashMap<Class<?>,Method>> g_castmap
			= new HashMap<Class<?>,HashMap<Class<?>,Method>>();
	public final static HashMap<Class<?>,Class<?>> g_typemap = new HashMap<Class<?>,Class<?>>();

	static
	{
		g_typemap.put(Integer.class,int.class);
		g_typemap.put(int.class,int.class);
		HashMap<Class<?>,Method> mdmap = null;

		mdmap = new HashMap<Class<?>,Method>();
		try
		{
			mdmap.put(boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("boolean2boolean",boolean.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("boolean2Boolean",boolean.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("boolean2byte",boolean.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("boolean2Byte",boolean.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("boolean2short",boolean.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("boolean2Short",boolean.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(int.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("boolean2int",boolean.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Integer.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("boolean2Integer",boolean.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("boolean2long",boolean.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("boolean2Long",boolean.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("boolean2float",boolean.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("boolean2Float",boolean.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("boolean2double",boolean.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("boolean2Double",boolean.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(String.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("boolean2String",boolean.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(ByteString.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("boolean2ByteString",boolean.class));
		}catch(Exception e)
		{
		}
		g_castmap.put(boolean.class,mdmap);

		mdmap = new HashMap<Class<?>,Method>();
		try
		{
			mdmap.put(boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Boolean2boolean",Boolean.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Boolean2Boolean",Boolean.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Boolean2byte",Boolean.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Boolean2Byte",Boolean.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Boolean2short",Boolean.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Boolean2Short",Boolean.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(int.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Boolean2int",Boolean.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Integer.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Boolean2Integer",Boolean.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Boolean2long",Boolean.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Boolean2Long",Boolean.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Boolean2float",Boolean.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Boolean2Float",Boolean.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Boolean2double",Boolean.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Boolean2Double",Boolean.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(String.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Boolean2String",Boolean.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(ByteString.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Boolean2ByteString",Boolean.class));
		}catch(Exception e)
		{
		}
		g_castmap.put(Boolean.class,mdmap);

		mdmap = new HashMap<Class<?>,Method>();
		try
		{
			mdmap.put(boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("byte2boolean",byte.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("byte2Boolean",byte.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("byte2byte",byte.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("byte2Byte",byte.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("byte2short",byte.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("byte2Short",byte.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(int.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("byte2int",byte.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Integer.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("byte2Integer",byte.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("byte2long",byte.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("byte2Long",byte.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("byte2float",byte.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("byte2Float",byte.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("byte2double",byte.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("byte2Double",byte.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(String.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("byte2String",byte.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(ByteString.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("byte2ByteString",byte.class));
		}catch(Exception e)
		{
		}
		g_castmap.put(byte.class,mdmap);

		mdmap = new HashMap<Class<?>,Method>();
		try
		{
			mdmap.put(boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Byte2boolean",Byte.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Byte2Boolean",Byte.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Byte2byte",Byte.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Byte2Byte",Byte.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Byte2short",Byte.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Byte2Short",Byte.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(int.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Byte2int",Byte.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Integer.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Byte2Integer",Byte.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Byte2long",Byte.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Byte2Long",Byte.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Byte2float",Byte.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Byte2Float",Byte.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Byte2double",Byte.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Byte2Double",Byte.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(String.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Byte2String",Byte.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(ByteString.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Byte2ByteString",Byte.class));
		}catch(Exception e)
		{
		}
		g_castmap.put(Byte.class,mdmap);

		mdmap = new HashMap<Class<?>,Method>();
		try
		{
			mdmap.put(boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("short2boolean",short.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("short2Boolean",short.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("short2byte",short.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("short2Byte",short.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("short2short",short.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("short2Short",short.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(int.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("short2int",short.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Integer.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("short2Integer",short.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("short2long",short.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("short2Long",short.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("short2float",short.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("short2Float",short.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("short2double",short.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("short2Double",short.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(String.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("short2String",short.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(ByteString.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("short2ByteString",short.class));
		}catch(Exception e)
		{
		}
		g_castmap.put(short.class,mdmap);

		mdmap = new HashMap<Class<?>,Method>();
		try
		{
			mdmap.put(boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Short2boolean",Short.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Short2Boolean",Short.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Short2byte",Short.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Short2Byte",Short.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Short2short",Short.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Short2Short",Short.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(int.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Short2int",Short.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Integer.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Short2Integer",Short.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Short2long",Short.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Short2Long",Short.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Short2float",Short.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Short2Float",Short.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Short2double",Short.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Short2Double",Short.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(String.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Short2String",Short.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(ByteString.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Short2ByteString",Short.class));
		}catch(Exception e)
		{
		}
		g_castmap.put(Short.class,mdmap);

		mdmap = new HashMap<Class<?>,Method>();
		try
		{
			mdmap.put(boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("int2boolean",int.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("int2Boolean",int.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("int2byte",int.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("int2Byte",int.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("int2short",int.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("int2Short",int.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(int.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("int2int",int.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Integer.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("int2Integer",int.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("int2long",int.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("int2Long",int.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("int2float",int.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("int2Float",int.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("int2double",int.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("int2Double",int.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(String.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("int2String",int.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(ByteString.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("int2ByteString",int.class));
		}catch(Exception e)
		{
		}
		g_castmap.put(int.class,mdmap);

		mdmap = new HashMap<Class<?>,Method>();
		try
		{
			mdmap.put(boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Integer2boolean",Integer.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Integer2Boolean",Integer.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Integer2byte",Integer.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Integer2Byte",Integer.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Integer2short",Integer.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Integer2Short",Integer.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(int.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Integer2int",Integer.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Integer.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Integer2Integer",Integer.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Integer2long",Integer.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Integer2Long",Integer.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Integer2float",Integer.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Integer2Float",Integer.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Integer2double",Integer.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Integer2Double",Integer.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(String.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Integer2String",Integer.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(ByteString.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Integer2ByteString",Integer.class));
		}catch(Exception e)
		{
		}
		g_castmap.put(Integer.class,mdmap);

		mdmap = new HashMap<Class<?>,Method>();
		try
		{
			mdmap.put(boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("long2boolean",long.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("long2Boolean",long.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("long2byte",long.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("long2Byte",long.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("long2short",long.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("long2Short",long.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(int.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("long2int",long.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Integer.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("long2Integer",long.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("long2long",long.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("long2Long",long.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("long2float",long.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("long2Float",long.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("long2double",long.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("long2Double",long.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(String.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("long2String",long.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(ByteString.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("long2ByteString",long.class));
		}catch(Exception e)
		{
		}
		g_castmap.put(long.class,mdmap);

		mdmap = new HashMap<Class<?>,Method>();
		try
		{
			mdmap.put(boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Long2boolean",Long.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Long2Boolean",Long.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Long2byte",Long.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Long2Byte",Long.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Long2short",Long.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Long2Short",Long.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(int.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Long2int",Long.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Integer.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Long2Integer",Long.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Long2long",Long.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Long2Long",Long.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Long2float",Long.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Long2Float",Long.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Long2double",Long.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Long2Double",Long.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(String.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Long2String",Long.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(ByteString.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Long2ByteString",Long.class));
		}catch(Exception e)
		{
		}
		g_castmap.put(Long.class,mdmap);

		mdmap = new HashMap<Class<?>,Method>();
		try
		{
			mdmap.put(boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("float2boolean",float.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("float2Boolean",float.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("float2byte",float.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("float2Byte",float.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("float2short",float.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("float2Short",float.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(int.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("float2int",float.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Integer.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("float2Integer",float.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("float2long",float.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("float2Long",float.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("float2float",float.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("float2Float",float.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("float2double",float.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("float2Double",float.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(String.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("float2String",float.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(ByteString.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("float2ByteString",float.class));
		}catch(Exception e)
		{
		}
		g_castmap.put(float.class,mdmap);

		mdmap = new HashMap<Class<?>,Method>();
		try
		{
			mdmap.put(boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Float2boolean",Float.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Float2Boolean",Float.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Float2byte",Float.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Float2Byte",Float.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Float2short",Float.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Float2Short",Float.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(int.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Float2int",Float.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Integer.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Float2Integer",Float.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Float2long",Float.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Float2Long",Float.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Float2float",Float.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Float2Float",Float.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Float2double",Float.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Float2Double",Float.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(String.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Float2String",Float.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(ByteString.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Float2ByteString",Float.class));
		}catch(Exception e)
		{
		}
		g_castmap.put(Float.class,mdmap);

		mdmap = new HashMap<Class<?>,Method>();
		try
		{
			mdmap.put(boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("double2boolean",double.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("double2Boolean",double.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("double2byte",double.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("double2Byte",double.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("double2short",double.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("double2Short",double.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(int.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("double2int",double.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Integer.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("double2Integer",double.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("double2long",double.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("double2Long",double.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("double2float",double.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("double2Float",double.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("double2double",double.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("double2Double",double.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(String.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("double2String",double.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(ByteString.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("double2ByteString",double.class));
		}catch(Exception e)
		{
		}
		g_castmap.put(double.class,mdmap);

		mdmap = new HashMap<Class<?>,Method>();
		try
		{
			mdmap.put(boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Double2boolean",Double.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Double2Boolean",Double.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Double2byte",Double.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Double2Byte",Double.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Double2short",Double.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Double2Short",Double.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(int.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Double2int",Double.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Integer.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Double2Integer",Double.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Double2long",Double.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Double2Long",Double.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Double2float",Double.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Double2Float",Double.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Double2double",Double.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Double2Double",Double.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(String.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Double2String",Double.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(ByteString.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("Double2ByteString",Double.class));
		}catch(Exception e)
		{
		}
		g_castmap.put(Double.class,mdmap);

		mdmap = new HashMap<Class<?>,Method>();
		try
		{
			mdmap.put(boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("String2boolean",String.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("String2Boolean",String.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("String2byte",String.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("String2Byte",String.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("String2short",String.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("String2Short",String.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(int.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("String2int",String.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Integer.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("String2Integer",String.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("String2long",String.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("String2Long",String.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("String2float",String.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("String2Float",String.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("String2double",String.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("String2Double",String.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(String.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("String2String",String.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(ByteString.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("String2ByteString",String.class));
		}catch(Exception e)
		{
		}
		g_castmap.put(String.class,mdmap);

		mdmap = new HashMap<Class<?>,Method>();
		try
		{
			mdmap.put(boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("ByteString2boolean",ByteString.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Boolean.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("ByteString2Boolean",ByteString.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("ByteString2byte",ByteString.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Byte.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("ByteString2Byte",ByteString.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("ByteString2short",ByteString.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Short.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("ByteString2Short",ByteString.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(int.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("ByteString2int",ByteString.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Integer.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("ByteString2Integer",ByteString.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("ByteString2long",ByteString.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Long.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("ByteString2Long",ByteString.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("ByteString2float",ByteString.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Float.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("ByteString2Float",ByteString.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("ByteString2double",ByteString.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(Double.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("ByteString2Double",ByteString.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(String.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("ByteString2String",ByteString.class));
		}catch(Exception e)
		{
		}
		try
		{
			mdmap.put(ByteString.class, Class.forName("com.jbm.core.common.Cast").getDeclaredMethod("ByteString2ByteString",ByteString.class));
		}catch(Exception e)
		{
		}
		g_castmap.put(ByteString.class,mdmap);
	}

	static protected Boolean boolean2boolean(boolean value)
	{
		return value;
	}
	static protected Boolean boolean2Boolean(boolean value)
	{
		return value;
	}
	static protected Byte boolean2byte(boolean value)
	{
		return value?(byte)1:(byte)0;
	}
	static protected Byte boolean2Byte(boolean value)
	{
		return value?(byte)1:(byte)0;
	}
	static protected Short boolean2short(boolean value)
	{
		return value?(short)1:(short)0;
	}
	static protected Short boolean2Short(boolean value)
	{
		return value?(short)1:(short)0;
	}
	static protected Integer boolean2int(boolean value)
	{
		return value?1:0;
	}
	static protected Integer boolean2Integer(boolean value)
	{
		return value?1:0;
	}
	static protected Long boolean2long(boolean value)
	{
		return value?1l:0l;
	}
	static protected Long boolean2Long(boolean value)
	{
		return value?1l:0l;
	}
	static protected Float boolean2float(boolean value)
	{
		return value?1f:0f;
	}
	static protected Float boolean2Float(boolean value)
	{
		return value?1f:0f;
	}
	static protected Double boolean2double(boolean value)
	{
		return value?1d:0d;
	}
	static protected Double boolean2Double(boolean value)
	{
		return value?1d:0d;
	}
	static protected String boolean2String(boolean value)
	{
		return String.valueOf(value);
	}
	static protected ByteString boolean2ByteString(boolean value)
	{
		return ByteString.copyFromUtf8(String.valueOf(value));
	}
	static protected Boolean Boolean2boolean(Boolean value)
	{
		return value;
	}
	static protected Boolean Boolean2Boolean(Boolean value)
	{
		return value;
	}
	static protected Byte Boolean2byte(Boolean value)
	{
		return value==null?0:value?(byte)1:(byte)0;
	}
	static protected Byte Boolean2Byte(Boolean value)
	{
		return value==null?null:value?(byte)1:(byte)0;
	}
	static protected Short Boolean2short(Boolean value)
	{
		return value?(short)1:(short)0;
	}
	static protected Short Boolean2Short(Boolean value)
	{
		return value?(short)1:(short)0;
	}
	static protected Integer Boolean2int(Boolean value)
	{
		return value==null?0:value?1:0;
	}
	static protected Integer Boolean2Integer(Boolean value)
	{
		return value==null?null:value?1:0;
	}
	static protected Long Boolean2long(Boolean value)
	{
		return value==null?0l:value?1l:0l;
	}
	static protected Long Boolean2Long(Boolean value)
	{
		return value==null?null:value?1l:0l;
	}
	static protected Float Boolean2float(Boolean value)
	{
		return value==null?0f:value?1f:0f;
	}
	static protected Float Boolean2Float(Boolean value)
	{
		return value==null?null:value?1f:0f;
	}
	static protected Double Boolean2double(Boolean value)
	{
		return value==null?0d:value?1d:0d;
	}
	static protected Double Boolean2Double(Boolean value)
	{
		return value==null?null:value?1d:0d;
	}
	static protected String Boolean2String(Boolean value)
	{
		return value==null?null: String.valueOf((boolean)value);
	}
	static protected ByteString Boolean2ByteString(Boolean value)
	{
		return value==null?null: ByteString.copyFromUtf8(String.valueOf((boolean)value));
	}
	static protected Boolean byte2boolean(byte value)
	{
		return value!=0;
	}
	static protected Boolean byte2Boolean(byte value)
	{
		return value!=0;
	}
	static protected Byte byte2byte(byte value)
	{
		return value;
	}
	static protected Byte byte2Byte(byte value)
	{
		return value;
	}
	static protected Short byte2short(byte value)
	{
		return (short)value;
	}
	static protected Short byte2Short(byte value)
	{
		return (short)value;
	}
	static protected Integer byte2int(byte value)
	{
		return (int)value;
	}
	static protected Integer byte2Integer(byte value)
	{
		return (int)value;
	}
	static protected Long byte2long(byte value)
	{
		return (long)value;
	}
	static protected Long byte2Long(byte value)
	{
		return (long)value;
	}
	static protected Float byte2float(byte value)
	{
		return (float)value;
	}
	static protected Float byte2Float(byte value)
	{
		return (float)value;
	}
	static protected Double byte2double(byte value)
	{
		return (double)value;
	}
	static protected Double byte2Double(byte value)
	{
		return (double)value;
	}
	static protected String byte2String(byte value)
	{
		return String.valueOf((int)value);
	}
	static protected ByteString byte2ByteString(byte value)
	{
		ByteBuffer bb = ByteBuffer.allocate(1);
		bb.put(value);
		bb.flip();
		return ByteString.copyFrom(bb);
	}
	static protected Boolean Byte2boolean(Byte value)
	{
		return value!=null&&value!=0;
	}
	static protected Boolean Byte2Boolean(Byte value)
	{
		return value==null?null:value!=0;
	}
	static protected Byte Byte2byte(Byte value)
	{
		return value==null?0:value;
	}
	static protected Byte Byte2Byte(Byte value)
	{
		return value;
	}
	static protected Short Byte2short(Byte value)
	{
		return value==null?(short)0:(short)value;
	}
	static protected Short Byte2Short(Byte value)
	{
		return value==null?null:(short)value;
	}
	static protected Integer Byte2int(Byte value)
	{
		return value==null?0:(int)value;
	}
	static protected Integer Byte2Integer(Byte value)
	{
		return value==null?null:(int)value;
	}
	static protected Long Byte2long(Byte value)
	{
		return value==null?0l:(long)value;
	}
	static protected Long Byte2Long(Byte value)
	{
		return value==null?null:(long)value;
	}
	static protected Float Byte2float(Byte value)
	{
		return value==null?0f:(float)value;
	}
	static protected Float Byte2Float(Byte value)
	{
		return value==null?null:(float)value;
	}
	static protected Double Byte2double(Byte value)
	{
		return value==null?0d:(double)value;
	}
	static protected Double Byte2Double(Byte value)
	{
		return value==null?null:(double)value;
	}
	static protected String Byte2String(Byte value)
	{
		return value==null?null: String.valueOf((int)value);
	}
	static protected ByteString Byte2ByteString(Byte value)
	{
		ByteBuffer bb = null;

		if ( value != null )
		{
			bb = ByteBuffer.allocate(1);
			bb.put(value);
			bb.flip();
		}

		return value==null?null: ByteString.copyFrom(bb);
	}
	static protected Boolean short2boolean(short value)
	{
		return value!=0;
	}
	static protected Boolean short2Boolean(short value)
	{
		return value!=0;
	}
	static protected Byte short2byte(short value)
	{
		return (byte)(value&0xff);
	}
	static protected Byte short2Byte(short value)
	{
		return (byte)(value&0xff);
	}
	static protected Short short2short(short value)
	{
		return value;
	}
	static protected Short short2Short(short value)
	{
		return value;
	}
	static protected Integer short2int(short value)
	{
		return (int)value;
	}
	static protected Integer short2Integer(short value)
	{
		return (int)value;
	}
	static protected Long short2long(short value)
	{
		return (long)value;
	}
	static protected Long short2Long(short value)
	{
		return (long)value;
	}
	static protected Float short2float(short value)
	{
		return (float)value;
	}
	static protected Float short2Float(short value)
	{
		return (float)value;
	}
	static protected Double short2double(short value)
	{
		return (double)value;
	}
	static protected Double short2Double(short value)
	{
		return (double)value;
	}
	static protected String short2String(short value)
	{
		return String.valueOf((int)value);
	}
	static protected ByteString short2ByteString(short value)
	{
		ByteBuffer bb = ByteBuffer.allocate(2);
		bb.putShort(value);
		bb.flip();
		return ByteString.copyFrom(bb);
	}
	static protected Boolean Short2boolean(Short value)
	{
		return value!=null&&value!=0;
	}
	static protected Boolean Short2Boolean(Short value)
	{
		return value==null?null:value!=0;
	}
	static protected Byte Short2byte(Short value)
	{
		return value==null?0:(byte)(value&0xff);
	}
	static protected Byte Short2Byte(Short value)
	{
		return value==null?null:(byte)(value&0xff);
	}
	static protected Short Short2short(Short value)
	{
		return value==null?0:value;
	}
	static protected Short Short2Short(Short value)
	{
		return value==null?null:value;
	}
	static protected Integer Short2int(Short value)
	{
		return value==null?0:(int)value;
	}
	static protected Integer Short2Integer(Short value)
	{
		return value==null?null:(int)value;
	}
	static protected Long Short2long(Short value)
	{
		return value==null?0l:(long)value;
	}
	static protected Long Short2Long(Short value)
	{
		return value==null?null:(long)value;
	}
	static protected Float Short2float(Short value)
	{
		return value==null?0f:(float)value;
	}
	static protected Float Short2Float(Short value)
	{
		return value==null?null:(float)value;
	}
	static protected Double Short2double(Short value)
	{
		return value==null?0d:(double)value;
	}
	static protected Double Short2Double(Short value)
	{
		return value==null?null:(double)value;
	}
	static protected String Short2String(Short value)
	{
		return value==null?null: String.valueOf((int)value);
	}
	static protected ByteString Short2ByteString(Short value)
	{
		ByteBuffer bb = null;

		if ( value != null )
		{
			bb = ByteBuffer.allocate(2);
			bb.putShort(value);
			bb.flip();
		}

		return value==null?null: ByteString.copyFrom(bb);
	}
	static protected Boolean int2boolean(int value)
	{
		return value!=0;
	}
	static protected Boolean int2Boolean(int value)
	{
		return value!=0;
	}
	static protected Byte int2byte(int value)
	{
		return (byte)(value&0xff);
	}
	static protected Byte int2Byte(int value)
	{
		return (byte)(value&0xff);
	}
	static protected Short int2short(int value)
	{
		return (short)(value&0xffff);
	}
	static protected Short int2Short(int value)
	{
		return (short)(value&0xffff);
	}
	static protected Integer int2int(int value)
	{
		return value;
	}
	static protected Integer int2Integer(int value)
	{
		return value;
	}
	static protected Long int2long(int value)
	{
		return (long)value;
	}
	static protected Long int2Long(int value)
	{
		return (long)value;
	}
	static protected Float int2float(int value)
	{
		return (float)value;
	}
	static protected Float int2Float(int value)
	{
		return (float)value;
	}
	static protected Double int2double(int value)
	{
		return (double)value;
	}
	static protected Double int2Double(int value)
	{
		return (double)value;
	}
	static protected String int2String(int value)
	{
		return String.valueOf(value);
	}
	static protected ByteString int2ByteString(int value)
	{
		ByteBuffer bb = ByteBuffer.allocate(4);
		bb.putInt(value);
		bb.flip();
		return ByteString.copyFrom(bb);
	}
	static protected Boolean Integer2boolean(Integer value)
	{
		return value!=null&&value!=0;
	}
	static protected Boolean Integer2Boolean(Integer value)
	{
		return value==null?null:value!=0;
	}
	static protected Byte Integer2byte(Integer value)
	{
		return value==null?0:(byte)(value&0xff);
	}
	static protected Byte Integer2Byte(Integer value)
	{
		return value==null?null:(byte)(value&0xff);
	}
	static protected Short Integer2short(Integer value)
	{
		return value==null?0:(short)(value&0xffff);
	}
	static protected Short Integer2Short(Integer value)
	{
		return value==null?null:(short)(value&0xffff);
	}
	static protected Integer Integer2int(Integer value)
	{
		return value==null?0:value;
	}
	static protected Integer Integer2Integer(Integer value)
	{
		return value;
	}
	static protected Long Integer2long(Integer value)
	{
		return value==null?0l:(long)value;
	}
	static protected Long Integer2Long(Integer value)
	{
		return value==null?null:(long)value;
	}
	static protected Float Integer2float(Integer value)
	{
		return value==null?0f:(float)value;
	}
	static protected Float Integer2Float(Integer value)
	{
		return value==null?null:(float)value;
	}
	static protected Double Integer2double(Integer value)
	{
		return value==null?0d:(double)value;
	}
	static protected Double Integer2Double(Integer value)
	{
		return value==null?null:(double)value;
	}
	static protected String Integer2String(Integer value)
	{
		return String.valueOf((int)value);
	}
	static protected ByteString Integer2ByteString(Integer value)
	{
		ByteBuffer bb = null;

		if ( value != null )
		{
			bb = ByteBuffer.allocate(4);
			bb.putInt(value);
			bb.flip();
		}

		return value==null?null: ByteString.copyFrom(bb);
	}
	static protected Boolean long2boolean(long value)
	{
		return value!=0;
	}
	static protected Boolean long2Boolean(long value)
	{
		return value!=0;
	}
	static protected Byte long2byte(long value)
	{
		return (byte)(value&0xff);
	}
	static protected Byte long2Byte(long value)
	{
		return (byte)(value&0xff);
	}
	static protected Short long2short(long value)
	{
		return (short)(value&0xffff);
	}
	static protected Short long2Short(long value)
	{
		return (short)(value&0xffff);
	}
	static protected Integer long2int(long value)
	{
		return (int)value;
	}
	static protected Integer long2Integer(long value)
	{
		return (int)value;
	}
	static protected Long long2long(long value)
	{
		return value;
	}
	static protected Long long2Long(long value)
	{
		return value;
	}
	static protected Float long2float(long value)
	{
		return (float)value;
	}
	static protected Float long2Float(long value)
	{
		return (float)value;
	}
	static protected Double long2double(long value)
	{
		return (double)value;
	}
	static protected Double long2Double(long value)
	{
		return (double)value;
	}
	static protected String long2String(long value)
	{
		return String.valueOf(value);
	}
	static protected ByteString long2ByteString(long value)
	{
		ByteBuffer bb = ByteBuffer.allocate(8);
		bb.putLong(value);
		bb.flip();
		return ByteString.copyFrom(bb);
	}
	static protected Boolean Long2boolean(Long value)
	{
		return value!=null&&value!=0;
	}
	static protected Boolean Long2Boolean(Long value)
	{
		return value==null?null:value!=0;
	}
	static protected Byte Long2byte(Long value)
	{
		return (byte)(value&0xff);
	}
	static protected Byte Long2Byte(Long value)
	{
		return value==null?null:(byte)(value&0xff);
	}
	static protected Short Long2short(Long value)
	{
		return (short)(value&0xffff);
	}
	static protected Short Long2Short(Long value)
	{
		return value==null?null:(short)(value&0xffff);
	}
	static protected Integer Long2int(Long value)
	{
		return value==null?0:(int)(long)value;
	}
	static protected Integer Long2Integer(Long value)
	{
		return value==null?null:(int)(long)value;
	}
	static protected Long Long2long(Long value)
	{
		return value==null?0:value;
	}
	static protected Long Long2Long(Long value)
	{
		return value;
	}
	static protected Float Long2float(Long value)
	{
		return value==null?0f:(float)value;
	}
	static protected Float Long2Float(Long value)
	{
		return value==null?null:(float)value;
	}
	static protected Double Long2double(Long value)
	{
		return value==null?0d:(double)value;
	}
	static protected Double Long2Double(Long value)
	{
		return value==null?null:(double)value;
	}
	static protected String Long2String(Long value)
	{
		return value==null?null: String.valueOf((long)value);
	}
	static protected ByteString Long2ByteString(Long value)
	{
		ByteBuffer bb = null;

		if ( value != null )
		{
			bb = ByteBuffer.allocate(8);
			bb.putLong(value);
			bb.flip();
		}

		return value==null?null: ByteString.copyFrom(bb);
	}
	static protected Boolean float2boolean(float value)
	{
		return value!=0;
	}
	static protected Boolean float2Boolean(float value)
	{
		return value!=0;
	}
	static protected Byte float2byte(float value)
	{
		return (byte)(((long)value)&0xff);
	}
	static protected Byte float2Byte(float value)
	{
		return (byte)(((long)value)&0xff);
	}
	static protected Short float2short(float value)
	{
		return (short)(((long)value)&0xffff);
	}
	static protected Short float2Short(float value)
	{
		return (short)(((long)value)&0xffff);
	}
	static protected Integer float2int(float value)
	{
		return (int)value;
	}
	static protected Integer float2Integer(float value)
	{
		return (int)value;
	}
	static protected Long float2long(float value)
	{
		return (long)value;
	}
	static protected Long float2Long(float value)
	{
		return (long)value;
	}
	static protected Float float2float(float value)
	{
		return value;
	}
	static protected Float float2Float(float value)
	{
		return value;
	}
	static protected Double float2double(float value)
	{
		return (double)value;
	}
	static protected Double float2Double(float value)
	{
		return (double)value;
	}
	static protected String float2String(float value)
	{
		return String.valueOf(value);
	}
	static protected ByteString float2ByteString(float value)
	{
		ByteBuffer bb = ByteBuffer.allocate(4);
		bb.putFloat(value);
		bb.flip();
		return ByteString.copyFrom(bb);
	}
	static protected Boolean Float2boolean(Float value)
	{
		return value!=null&&value!=0;
	}
	static protected Boolean Float2Boolean(Float value)
	{
		return value==null?null:value!=0;
	}
	static protected Byte Float2byte(Float value)
	{
		return value==null?0:(byte)(((long)(float) value)&0xff);
	}
	static protected Byte Float2Byte(Float value)
	{
		return value==null?null:(byte)(((long)(float) value)&0xff);
	}
	static protected Short Float2short(Float value)
	{
		return value==null?0:(short)(((long)(float) value)&0xffff);
	}
	static protected Short Float2Short(Float value)
	{
		return value==null?null:(short)(((long)(float) value)&0xffff);
	}
	static protected Integer Float2int(Float value)
	{
		return value==null?0:(int)(float)value;
	}
	static protected Integer Float2Integer(Float value)
	{
		return value==null?null:(int)(float)value;
	}
	static protected Long Float2long(Float value)
	{
		return value==null?0:(long)(float)value;
	}
	static protected Long Float2Long(Float value)
	{
		return value==null?null:(long)(float)value;
	}
	static protected Float Float2float(Float value)
	{
		return value==null?0:value;
	}
	static protected Float Float2Float(Float value)
	{
		return value;
	}
	static protected Double Float2double(Float value)
	{
		return value==null?0d:(double)value;
	}
	static protected Double Float2Double(Float value)
	{
		return value==null?null:(double)value;
	}
	static protected String Float2String(Float value)
	{
		return value==null?null: String.valueOf((float)value);
	}
	static protected ByteString Float2ByteString(Float value)
	{
		ByteBuffer bb = null;

		if ( value != null )
		{
			bb = ByteBuffer.allocate(4);
			bb.putFloat(value);
			bb.flip();
		}

		return value==null?null: ByteString.copyFrom(bb);
	}
	static protected Boolean double2boolean(double value)
	{
		return value!=0;
	}
	static protected Boolean double2Boolean(double value)
	{
		return value!=0;
	}
	static protected Byte double2byte(double value)
	{
		return (byte)(((long)value)&0xff);
	}
	static protected Byte double2Byte(double value)
	{
		return (byte)(((long)value)&0xff);
	}
	static protected Short double2short(double value)
	{
		return (short)(((long)value)&0xffff);
	}
	static protected Short double2Short(double value)
	{
		return (short)(((long)value)&0xffff);
	}
	static protected Integer double2int(double value)
	{
		return (int)value;
	}
	static protected Integer double2Integer(double value)
	{
		return (int)value;
	}
	static protected Long double2long(double value)
	{
		return (long)value;
	}
	static protected Long double2Long(double value)
	{
		return (long)value;
	}
	static protected Float double2float(double value)
	{
		return (float)value;
	}
	static protected Float double2Float(double value)
	{
		return (float)value;
	}
	static protected Double double2double(double value)
	{
		return value;
	}
	static protected Double double2Double(double value)
	{
		return value;
	}
	static protected String double2String(double value)
	{
		return String.valueOf(value);
	}
	static protected ByteString double2ByteString(double value)
	{
		ByteBuffer bb = ByteBuffer.allocate(8);
		bb.putDouble(value);
		bb.flip();
		return ByteString.copyFrom(bb);
	}
	static protected Boolean Double2boolean(Double value)
	{
		return value!=null&&value!=0;
	}
	static protected Boolean Double2Boolean(Double value)
	{
		return value==null?null:value!=0;
	}
	static protected Byte Double2byte(Double value)
	{
		return value==null?0:(byte)(((long)(double)value)&0xff);
	}
	static protected Byte Double2Byte(Double value)
	{
		return value==null?null:(byte)(((long)(double)value)&0xff);
	}
	static protected Short Double2short(Double value)
	{
		return value==null?0:(short)(((long)(double)value)&0xffff);
	}
	static protected Short Double2Short(Double value)
	{
		return value==null?null:(short)(((long)(double)value)&0xffff);
	}
	static protected Integer Double2int(Double value)
	{
		return value==null?0:(int)(double)value;
	}
	static protected Integer Double2Integer(Double value)
	{
		return value==null?null:(int)(double)value;
	}
	static protected Long Double2long(Double value)
	{
		return value==null?0:(long)(double)value;
	}
	static protected Long Double2Long(Double value)
	{
		return value==null?null:(long)(double)value;
	}
	static protected Float Double2float(Double value)
	{
		return value==null?0:(float)(double)value;
	}
	static protected Float Double2Float(Double value)
	{
		return value==null?null:(float)(double)value;
	}
	static protected Double Double2double(Double value)
	{
		return value==null?0:value;
	}
	static protected Double Double2Double(Double value)
	{
		return value;
	}
	static protected String Double2String(Double value)
	{
		return value==null?null: String.valueOf((double)value);
	}
	static protected ByteString Double2ByteString(Double value)
	{
		ByteBuffer bb = null;

		if ( value != null )
		{
			bb = ByteBuffer.allocate(8);
			bb.putDouble(value);
			bb.flip();
		}

		return value==null?null: ByteString.copyFrom(bb);
	}
	static protected Boolean String2boolean(String value)
	{
		return value!=null&& Boolean.valueOf(value);
	}
	static protected Boolean String2Boolean(String value)
	{
		return value==null?null: Boolean.valueOf(value);
	}
	static protected Byte String2byte(String value)
	{
		return value==null?0: Byte.valueOf(value);
	}
	static protected Byte String2Byte(String value)
	{
		return value==null?null: Byte.valueOf(value);
	}
	static protected Short String2short(String value)
	{
		return value==null?0: Short.valueOf(value);
	}
	static protected Short String2Short(String value)
	{
		return value==null?null: Short.valueOf(value);
	}
	static protected Integer String2int(String value)
	{
		return value==null?0: Integer.valueOf(value);
	}
	static protected Integer String2Integer(String value)
	{
		return value==null?null: Integer.valueOf(value);
	}
	static protected Long String2long(String value)
	{
		return value==null?0: Long.valueOf(value);
	}
	static protected Long String2Long(String value)
	{
		return value==null?null: Long.valueOf(value);
	}
	static protected Float String2float(String value)
	{
		return value==null?0: Float.valueOf(value);
	}
	static protected Float String2Float(String value)
	{
		return value==null?null: Float.valueOf(value);
	}
	static protected Double String2double(String value)
	{
		return value==null?0: Double.valueOf(value);
	}
	static protected Double String2Double(String value)
	{
		return value==null?null: Double.valueOf(value);
	}
	static protected String String2String(String value)
	{
		return value;
	}
	static protected ByteString String2ByteString(String value)
	{
		return value==null?null: ByteString.copyFromUtf8(value);
	}
	static protected Boolean ByteString2boolean(ByteString value)
	{
		return value!=null&& Boolean.valueOf(value.toStringUtf8());
	}
	static protected Boolean ByteString2Boolean(ByteString value)
	{
		return value==null?null: Boolean.valueOf(value.toStringUtf8());
	}
	static protected Byte ByteString2byte(ByteString value)
	{
		return value==null?0:value.toByteArray()[0];
	}
	static protected Byte ByteString2Byte(ByteString value)
	{
		return value==null?null:value.toByteArray()[0];
	}
	static protected Short ByteString2short(ByteString value)
	{
		ByteBuffer bb = ByteBuffer.allocate(2);

		if ( value != null )
		{
			value.copyTo(bb);
			bb.flip();
		}
		return value==null?0:bb.getShort();
	}
	static protected Short ByteString2Short(ByteString value)
	{
		ByteBuffer bb = ByteBuffer.allocate(2);

		if ( value != null )
		{
			value.copyTo(bb);
			bb.flip();
		}
		return value==null?null:bb.getShort();
	}
	static protected Integer ByteString2int(ByteString value)
	{
		ByteBuffer bb = ByteBuffer.allocate(4);

		if ( value != null )
		{
			value.copyTo(bb);
			bb.flip();
		}
		return value==null?0:bb.getInt();
	}
	static protected Integer ByteString2Integer(ByteString value)
	{
		ByteBuffer bb = ByteBuffer.allocate(4);

		if ( value != null )
		{
			value.copyTo(bb);
			bb.flip();
		}
		return value==null?null:bb.getInt();
	}
	static protected Long ByteString2long(ByteString value)
	{
		ByteBuffer bb = ByteBuffer.allocate(8);

		if ( value != null )
		{
			value.copyTo(bb);
			bb.flip();
		}
		return value==null?0:bb.getLong();
	}
	static protected Long ByteString2Long(ByteString value)
	{
		ByteBuffer bb = ByteBuffer.allocate(4);

		if ( value != null )
		{
			value.copyTo(bb);
			bb.flip();
		}
		return value==null?null:bb.getLong();
	}
	static protected Float ByteString2float(ByteString value)
	{
		ByteBuffer bb = ByteBuffer.allocate(4);

		if ( value != null )
		{
			value.copyTo(bb);
			bb.flip();
		}
		return value==null?0:bb.getFloat();
	}
	static protected Float ByteString2Float(ByteString value)
	{
		ByteBuffer bb = ByteBuffer.allocate(4);

		if ( value != null )
		{
			value.copyTo(bb);
			bb.flip();
		}
		return value==null?null:bb.getFloat();
	}
	static protected Double ByteString2double(ByteString value)
	{
		ByteBuffer bb = ByteBuffer.allocate(4);

		if ( value != null )
		{
			value.copyTo(bb);
			bb.flip();
		}
		return value==null?0:bb.getDouble();
	}
	static protected Double ByteString2Double(ByteString value)
	{
		ByteBuffer bb = ByteBuffer.allocate(4);

		if ( value != null )
		{
			value.copyTo(bb);
			bb.flip();
		}
		return value==null?null:bb.getDouble();
	}
	static protected String ByteString2String(ByteString value)
	{
		return value==null?null:value.toStringUtf8();
	}
	static protected ByteString ByteString2ByteString(ByteString value)
	{
		return value;
	}
	static public Object Cast (Object value, Class<?> type )
	{
		if ( value.getClass() == type )
			return value;

		HashMap<Class<?>,Method> mdmap = g_castmap.get(value.getClass());

		if ( mdmap == null )
			if ( value.getClass().getSimpleName().contains("ByteString"))
				mdmap = g_castmap.get(ByteString.class);

		if ( mdmap == null )
			return null;

		Method md = mdmap.get(type);

		if ( md == null )
			return null;

		try
		{
			return md.invoke(null, value);
		}catch (Exception e)
		{
		}

		return null;
	}
}
